package com.file;

import java.io.File;

public class DeleteDirDemo {
    public static void main(String[] args) {
        File file = new File("./demo");
        if (file.exists()) {
            file.delete();//前提是目录必须是空的才能删除掉，否则删除不了
            System.out.println("删除成功");
        } else {
            System.out.println("目录不存在");
        }
    }
}
